/**
 * \class Assignment AbsSyn/Assignment.h
 *
 * \brief Assignment Statement in abst.
 *
 * Assignment statement in a abstract syntax tree: example of Assignment
 * ident = exp
 *
 *
 *  \ingroup AbsSyn
 */

#ifndef ASSIGNMENT_H_
#define ASSIGNMENT_H_

#include <AbsSyn/IStmt.h>
#include <AbsSyn/AbsSyn.h>

class IExp;
class Ident;

class Assignment: public IStmt {
public:
	Assignment(Ident* ident, IExp* exp);
	virtual ~Assignment();


	virtual std::string cmdString() const;
	/**
	 * \brief implements Visitor pattern
	 *
	 * @see IStmtVisitor
	 * @param v
	 */

	virtual void accept(IStmtVisitor *v);
	/**
	 *
	 * \addtogroup Cloneable
	 * @{
	 *
	 * \brief Implements cloneable
	 *
	 * Returns copy of the Assignment
	 *
	 * @return
	 */
	virtual Assignment* clone() const;
	/**@}*/

	/**
	 * \brief Getter method for the identity variable
	 *
	 * Get a copy of the ident name for the assignment, the caller
	 * needs to release it when done
	 *
	 * \todo use boostShared_ptr instead.
	 *
	 * \return Ident
	 *
	 */
	Ident* getIdent() const;

	/**
	 * \brief Set the identity for Assignment.
	 *
	 * The argument will be copied. Therefore the argument is the callers responsibility.
	 *
	 * @param ident
	 */
	void setIdent(const Ident& ident);

	/**
	 * \brief Getter method for expression
	 *
	 * Get a copy of expression associated with the statement, the caller is
	 * responsible for releasing the return object.
	 *
	 * @return Expression
	 */
	IExp* getExp() const;

	/**
	 * \brief Set method for expression associated with assignment
	 *
	 * The method will swap the expression associated with Assignment.
	 * The caller is responsible for deleting the argument since it will be copied.
	 *
	 * @param exp new expression
	 *
	 */
	void setExp(const IExp& exp);


private:
	Ident* m_Ident;
	IExp* m_Exp;

};

#endif /* ASSIGNMENT_H_ */
